<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商品卡布局</title>
    <style>
      #container{
  display: grid;
  grid-template-columns: 170px 170px 170px 170px 170px;
  grid-template-rows: 250px 250px;
  grid-row-gap: 1px;
  grid-column-gap: 10px;
  background-color: #ccc8c8;
  width:895px;
  margin: 0 auto;
      }
.item {
  font-size: 2em;
  text-align: center;
  margin-top: 5px;
  margin-bottom: 5px;
}

.item-1 {
  background: url(./111.png)  ;
  grid-row-start: 1;
  grid-row-end: 3; 
  margin-left: 5px; 
}

.item-2 {
    background: url(./222.png)  ;
}

.item-3 {
    background: url(./333.png)  ;
}

.item-4 {
    background: url(./444.png)  ;
}

.item-5 {
    background: url(./555.png)  ;
}

.item-6 {
    background: url(./666.png)  ;
}
.item-7 {
    background: url(./777.png)  ;
}

.item-8 {
    background: url(./888.png)  ;
}

.item-9 {
    background: url(./999.png)  ;
}
h1{
    text-align: center;
}
#container2{
    display:flex;
    flex-wrap: wrap;
    /* justify-content: flex-end; */
    flex: 1 1 150px;
    width: 900px;
    height: 520px;
    background-color: #ccc8c8;
    /* align-items:flex-end; */
    margin: 0 auto;
}
.center{
    justify-content: center;
}
.itemm{
    width: 170px;
    height:250px;
    margin:5px 5px 5px 5px;
}
.itemm-1 {
  background: url(./111.png);
  height: 510px;
}
    </style>
</head>
<body>
    <h1>gird布局</h1>
    <div >
        <div id="container" >
        <div class="item item-1"></div>
        <div class="item item-2"></div>
        <div class="item item-3"></div>
        <div class="item item-4"></div>
        <div class="item item-5"></div>
        <div class="item item-6"></div>
        <div class="item item-7"></div>
        <div class="item item-8"></div>
        <div class="item item-9"></div>
      </div>
    </div>
    <br>
    <hr>
    <br>
    <h1>flex布局</h1>
    <div id="container2">
        <div class="itemm itemm-1"></div>
        <div id="container2" >
        <div class="itemm item-2"></div>
        <div class="itemm item-3"></div>
        <div class="itemm item-4"></div>
        <div class="itemm item-5"></div>
        <div class="itemm item-6"></div>
        <div class="itemm item-7"></div>
        <div class="itemm item-8"></div>
        <div class="itemm item-9"></div>
      </div> 
    </div>
   <br>
</body>
</html>